# -*- coding: utf-8 -*-
# @Author: QX
# @File: VarRender.py
'''

# 字符串模板进行参数渲染
# 使用 jinja2 模板引擎 (类似 flask的模板)
pip install jinja2
# https://docs.jinkan.org/docs/jinja2/templates.html
'''
from jinja2  import Template
def ReFresh(target,context):
    '''

    :param target:
    :param context:
    :return:
    '''
    result = Template(str(target)).render(context)
    return result
if __name__ == '__main__':
    #target="你好!{{name}}"
    target={'nameu':'{{name}}','age':'{{age}}'}
    context={"name":'jenny','age':18}
    r = ReFresh(target, context)
    print(type(eval(r)))
